using NodeCanvas.Variables;

namespace NodeCanvas.Conditions
{
	[Category("✫ Utility")]
	[Description("Check if an event is received and return true for one frame")]
	[EventListener(new string[] { "OnCustomEvent" })]
	public class CheckEvent : ConditionTask
	{
		[RequiredField]
		public BBString eventName;

		protected override string info
		{
			get
			{
				return string.Concat("[", eventName, "]");
			}
		}

		protected override bool OnCheck()
		{
			return false;
		}

		public void OnCustomEvent(string receivedEvent)
		{
			if (receivedEvent == eventName.value)
			{
				YieldReturn(true);
			}
		}
	}
}
